//
//  RapidCashierViewController.m
//  HAODE
//
//  Created by panquanReabam.com on 15/9/26.
//  Copyright (c) 2015年 reabam.com. All rights reserved.
#import "RapidCashierViewController.h"
#import "RDVTabBarController.h"
#import "AttributedLabel.h"
#import "UIViewExt.h"
#import "HttpRequest.h"
#import "OrderExtAddViewController1.h"
#import "QRCodeGenerator.h"
#import "UIButton+WebCache.h"
#import "UIImage+RTTint.h"
#import "TheKeyboardView.h"
@interface RapidCashierViewController ()<UIScrollViewDelegate,UIGestureRecognizerDelegate,TheKeyboardViewDelegate>
@end
@implementation RapidCashierViewController
{
    TheKeyboardView*KeyboardView;
    NSString*Token;
}
@synthesize alt = alt;
-(void)BackAction:(UIButton *)sender{

    [self.navigationController popViewControllerAnimated:YES];
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden=YES;
    [[self rdv_tabBarController] setTabBarHidden:YES];
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    Token = [user objectForKey:@"tokenId"];

    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
}
-(void)loadingtitle{
   UIView*naviView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 64)];
    naviView.backgroundColor=[UIColor colorWithRed:14/255.0 green:23/255.0 blue:0/255.0 alpha:1.0];
    [self.view addSubview:naviView];

    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(10,27.5,30,30);
    UIButton*backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    UILabel*titleStr=[[UILabel alloc]initWithFrame:CGRectMake(0, 10, ScreenWidth, 64)];
    titleStr.text=@"快速收银";
    titleStr.textColor=[UIColor whiteColor];
    titleStr.font=[UIFont systemFontOfSize:18];
    titleStr.textAlignment=NSTextAlignmentCenter;
    [self.view addSubview:titleStr];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadingtitle];
    [self cashier];
}
//other收银
-(void)cashier{
    KeyboardView=[[TheKeyboardView alloc]initWithFrame:CGRectMake(0, 64, ScreenWidth, ScreenHeight)];
    KeyboardView.mDelegate=self;
    [self.view addSubview:KeyboardView];
}
-(void)payTreasure:(NSString *)strPay{
//    NSLog(@"%d",KeyboardView.wufuhaopayAmount.text.intValue);
    
    double d;
    d=[KeyboardView.wufuhaopayAmount.text doubleValue];
    if (d<=0)
        {
            [self showAlertMessage:@"请输入大于0的值！"];
            
        
        }else{
    OrderExtAddViewController1*vc1=[[OrderExtAddViewController1 alloc] init];
    vc1.prices=KeyboardView.wufuhaopayAmount.text;
    vc1.OrderSat=@"GOrder/Add";
    vc1.memberDict=self.memberDict;
    [self.navigationController pushViewController:vc1 animated:YES];
                }
}
- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}
- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}
@end
